import { requestApi } from "@/utils/request"
import type { getCompanionCityResponse, getCompanionHomeResponse, getCompanionMemberResponse, getMyActivitiesResponse, getCompanionDetailsResponse } from "@/types/companion"


// 获取结伴城市
export const getCompanionCityAPI = () => {
    return requestApi<getCompanionCityResponse>({
        url: '/companion-city',
        method: 'GET'
    })
}


// 首页筛选活动
export const getCompanionHomeAPI = (data: {
    city: string;
    keyword: string;
    page: number;
}) => {
    return requestApi<getCompanionHomeResponse>({
        url: '/companion-query',
        method: 'GET',
        data
    })
}

// 发起结伴活动
export const initPartnerAPI = (data: {
    description: string;
    image: string[];
    city: string;
    full_address: string;
    companion_time: string;
    number_of_people: number;
}) => {
    return requestApi({
        url: '/initiating-partner',
        method: 'POST',
        data
    })
}

// 管理成员
export const manageMemberAPI = (data: {
    _id:string
    page: number;
}) => { 
    return requestApi<getCompanionMemberResponse>({
        url: '/managing-member',
        method: 'GET',
        data
    })
}

//我参与的活动和我发起的活动通用接口
export const myActivitiesAPI = (url:string,data: {
    page: number;
}) => {
    return requestApi<getMyActivitiesResponse>({
        url: url,
        method: 'GET',
        data
    })
}

// 查询用户是否已经报名
export const checkUserSignupAPI = (data: {
    id: string;
}) => {
    return requestApi({
        url: '/signup-query',
        method: 'GET',
        data
    })
}

// 获取结伴活动详情
export const getCompanionDetailsAPI = (data: {
    id: string;
}) => {
    return requestApi<getCompanionDetailsResponse>({
        url: '/companion-details',
        method: 'GET',
        data
    })
}

// 用户报名结伴活动
export const userSignupAPI = (data: {
    signup_id: string;
    contact_inform: string;
    gender: number;
    introduce: string;
}) => {
    return requestApi({
        url: '/sign-up-partner',
        method: 'POST',
        data
    })
}